<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-table.css">
    <title></title>
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: "微软雅黑";
        }

        html {
            font-size: 62.5%;
        }

        html, body, content {
            width: 100%;
            height: 100%;
        }

        table {
            border-collapse: collapse;
            table-layout: fixed;
            border-left: 1px solid #ddd;
            border-right: 1px solid #ddd;
        }

        table, th, td {
            padding: 3px 0px;
            text-align: center;
            word-wrap: break-word;
        }

        th {
            background: rgb(0, 80, 85);
            color: #fff;
            cursor: pointer;
        }

        td {
            color: #000;
            background: #fdfdfd;
            cursor: pointer;
            border: 1px solid #ddd;
        }

        .content {
            width: 100%;
            height: 100%;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            padding: 10px;
        }

        #select_month {
            width: 140px;
            margin: 10px 0 20px 20px;
        }

        #select_month:focus {
            background: rgb(249, 249, 170);
        }

        .table-responsive {
            width: 100%;
            padding: 0 10px;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        .bootstrap-table .table thead > tr > th,
        .bootstrap-table .table:not(.table-condensed),
        .bootstrap-table .table:not(.table-condensed) > tbody > tr > th,
        .bootstrap-table .table:not(.table-condensed) > tfoot > tr > th,
        .bootstrap-table .table:not(.table-condensed) > thead > tr > td,
        .bootstrap-table .table:not(.table-condensed) > tbody > tr > td,
        .bootstrap-table .table:not(.table-condensed) > tfoot > tr > td {
            padding: 5px 0;
        }


    </style>
</head>
<body>
<div class="content">
    <!--<select id="select_month">-->
        <!--<option value="">1月</option>-->
        <!--<option value="">2月</option>-->
        <!--<option value="">3月</option>-->
        <!--<option value="">4月</option>-->
    <!--</select>-->
    <div class="table-responsive">
        <table id="table" class="table"></table>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-table.js"></script>
<script src="js/template.js"></script>
<script src="js/vii-placeholder.js"></script>
<script>


    /*
    * formatterPerformance
    *  绩效单元格回调
    * */
    function formatterPerformance(row, value, month) {
        var $div = "";
        if (row.name === "岗位绩效") {
            $div = "<div onclick='openJobPerformanceDetails(\"" + row.nurseId + "\",\"" + month + "\")'>" + value + "</div>";
        } else if (row.name === "血源发展绩效") {
            $div = "<div onclick='openDevelopeDetails(\"" + row.nurseId + "\",\"" + month + "\")'>" + value + "</div>";
        } else if (row.name === "奖惩金额") {
            $div = "<div onclick='openBonusPenalty(\"" + row.nurseId + "\",\"" + month + "\")'>" + value + "</div>";
        } else {
            $div = value;
        }
        return $div;
    }

    $(function () {

        var item = [
            {
                "id": "08793594-8453-4757-a5b8-e8330a7d7bb2",
                "baseWages": 1304,
                "postWages": 1231,
                "providerDevWages": 390,
                "rewardPunishWages": 0,
                "shouldWages": 2925,
                "actualWages": 2925,
                "nurseId": "mxz26",
                "nurseName": "褚义霞",
                "year": "2018",
                "month": 4
            },
            {
                "id": "09f711c0-3808-42f2-b47c-23b007e11784",
                "baseWages": 1304,
                "postWages": 241,
                "providerDevWages": 285,
                "rewardPunishWages": 0,
                "shouldWages": 1830,
                "actualWages": 1830,
                "nurseId": "mxz26",
                "nurseName": "褚义霞",
                "year": "2018",
                "month": 1
            },
            {
                "id": "32fe1d78-5b12-4347-b6cc-75d7611eaf96",
                "baseWages": 1304,
                "postWages": 1846,
                "providerDevWages": 900,
                "rewardPunishWages": 0,
                "shouldWages": 4050,
                "actualWages": 4050,
                "nurseId": "mxz26",
                "nurseName": "褚义霞",
                "year": "2018",
                "month": 3
            },
            {
                "id": "70e49855-a0c7-422d-bfb4-9c84d97bb401",
                "baseWages": 1304,
                "postWages": 0,
                "providerDevWages": 135,
                "rewardPunishWages": 0,
                "shouldWages": 1439,
                "actualWages": 1439,
                "nurseId": "mxz26",
                "nurseName": "褚义霞",
                "year": "2018",
                "month": 5
            },
            {
                "id": "827b3393-9c57-41d1-935e-a8a5fd691846",
                "baseWages": 1304,
                "postWages": 1861,
                "providerDevWages": 675,
                "rewardPunishWages": 0,
                "shouldWages": 3840,
                "actualWages": 3840,
                "nurseId": "mxz26",
                "nurseName": "褚义霞",
                "year": "2018",
                "month": 2
            }
        ];
            for (var l = item.length; l < 12; l++) {
                item.push({
                    baseWages: "",
                    postWages: "",
                    providerDevWages: "",
                    rewardPunishWages: "",
                    shouldWages: "",
                    actualWages: "",
                    month: l + 1
                });
            }
            item.sort(function (a, b) {
                return a.month - b.month;
            });
            var mapping = {
                baseWages: '基本工资',
                postWages: '岗位绩效',
                providerDevWages: '血源发展绩效',
                rewardPunishWages: '奖惩金额',
                shouldWages: '应发工资',
                actualWages: '实发工资'
            };
            var newResult = [];
            for (var key in mapping) {
                var item1, items = {
                    name: mapping[key]
                };
                for (var i = 0, len = item.length; i < len; i++) {
                    item1 = item[i];
                    items['month' + ( i + 1 )] = item1[key];
                    items['nurseId'] = $("#coverTableSelect").val();
                }
                newResult.push(items);
            }
            $("#table").bootstrapTable('destroy').bootstrapTable({
                cache: false,
                data: newResult,
                undefinedText: "",
                sortName: "month",
                columns: [
                    {
                        width: "10%",
                        title: '项目名称',
                        field: "name"
                    },
                    {
                        width: "7.5%",
                        title: '1月',
                        field: "month1",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "1")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '2月',
                        field: "month2",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "2")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '3月',
                        field: "month3",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "3")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '4月',
                        field: "month4",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "4")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '5月',
                        field: "month5",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "5")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '6月',
                        field: "month6",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "6")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '7月',
                        field: "month7",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "7")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '8月',
                        field: "month8",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "8")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '9月',
                        field: "month9",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "9")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '10月',
                        field: "month10",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "10")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '11月',
                        field: "month11",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "11")
                        }
                    },
                    {
                        width: "7.5%",
                        title: '12月',
                        field: "month12",
                        formatter: function (value, row, index) {
                            return formatterPerformance(row, value, "12")
                        }
                    }
                ]
            });

//        $("#table").bootstrapTable('destroy').bootstrapTable({
//            cache: false,
//            data: list,
//            height: $(".content").height() - $("#select_month").height() - 40,
//            undefinedText: "",
//            columns: [
//                {
//                    width: "7%",
//                    title: '序号',
//                    formatter: function (value, row, index) {
//                        return index + 1;
//                    }
//                },
//                {
//                    width: "7%",
//                    title: '姓名',
//                    sortable: true,
//                    field: "name"
//                },
//                {
//                    width: "7%",
//                    title: '基本工资',
//                    field: "jbgz",
//                    sortable: true
//                },
//                {
//                    width: "7%",
//                    title: '采浆标准',
//                    field: "cjbz",
//                    sortable: true
//                },
//                {
//                    width: "7%",
//                    title: '基础量',
//                    sortable: true,
//                    field: "jcl"
//                },
//                {
//                    width: "7%",
//                    title: '月份采集量',
//                    sortable: true,
//                    field: "yfcjl"
//                },
//                {
//                    width: "7%",
//                    title: '采浆总额',
//                    sortable: true,
//                    field: "cjze"
//                },
//                {
//                    width: "7%",
//                    title: '采浆绩效',
//                    sortable: true,
//                    field: "cjjx"
//                },
//                {
//                    width: "7%",
//                    title: '发展浆量',
//                    sortable: true,
//                    field: "fzjl"
//                },
//                {
//                    width: "7%",
//                    title: '发展标准',
//                    sortable: true,
//                    field: "fzbz"
//                },
//                {
//                    width: "7%",
//                    title: '发展绩效',
//                    sortable: true,
//                    field: "fzjx"
//                },
//                {
//                    width: "7%",
//                    title: '奖惩绩效',
//                    sortable: true,
//                    field: "jcjx"
//                },
//                {
//                    width: "7%",
//                    title: '实发绩效',
//                    sortable: true,
//                    field: "sfjx"
//                },
//                {
//                    width: "7%",
//                    title: '实发工资',
//                    sortable: true,
//                    field: "sfgz"
//                },
//                {
//                    width: "7%",
//                    title: '备注',
//                    sortable: true,
//                    field: "bz"
//                }
//            ]
//        });


    })


</script>
</body>
</html>